package com.jdyfy.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jdyfy.dto.ProjectAnnounceDTO;
import com.jdyfy.entity.AnnouncementDepartment;
import com.jdyfy.entity.Project;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface AnnouncementDepartmentMapper extends BaseMapper<AnnouncementDepartment> {

    // 获取报名企业名
    List<AnnouncementDepartment> getEnlistsDepartment(@Param("announcements") List<String> announcements);

    // 根据公告名称获取报名企业
    AnnouncementDepartment getEnlistsDepartments(@Param("announcementName") String announcementName);

    // 根据报名企业获取公告名称
    List<ProjectAnnounceDTO> getEnlistsAnnouncementsBydepartment(
            @Param("departmentName") String departmentName,
            @Param("projectName") String projectName,
            @Param("projectNumber") String projectNumber);

    @Select("SELECT COUNT(*) FROM announcement_department WHERE announcement_name = #{announcementName}")
    int getEnrollCount(String announcementName);

    @Select("SELECT COUNT(*) FROM announcement_department WHERE announcement_name = #{announcementName} AND department_name = #{departmentName}")
    int getAdIsHave(@Param("announcementName") String announcementName,@Param("departmentName") String departmentName);
}
